home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / campki~1.zip / CLIENT.QC < prev    next >
Text File  |  1996-10-05  |  34KB  |  1,468 lines

  1. //Search on: MRB
  2.  
  3. // prototypes
  4. void () W_WeaponFrame;
  5. void() W_SetCurrentAmmo;
  6. void() player_pain;
  7. void() player_stand1;
  8. void (vector org) spawn_tfog;
  9. void (vector org, entity death_owner) spawn_tdeath;
  10.  
  11. float    modelindex_eyes, modelindex_player;
  12.  
  13. /*
  14. =============================================================================
  15.  
  16.                 LEVEL CHANGING / INTERMISSION
  17.  
  18. =============================================================================
  19. */
  20.  
  21. float    intermission_running;
  22. float    intermission_exittime;
  23.  
  24. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  25. This is the camera point for the intermission.
  26. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  27. */
  28. void() info_intermission =
  29. {
  30. };
  31.  
  32.  
  33.  
  34. void() SetChangeParms =
  35. {
  36.     if (self.health <= 0)
  37.     {
  38.         SetNewParms ();
  39.         return;
  40.     }
  41.  
  42. // remove items
  43.     self.items = self.items - (self.items & 
  44.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  45.     
  46. // cap super health
  47. //MRB Changed from 100 to 150
  48.     if (self.health > 150)
  49.         self.health = 150;
  50.     if (self.health < 50)
  51.         self.health = 50;
  52.     parm1 = self.items;
  53.     parm2 = self.health;
  54.     parm3 = self.armorvalue;
  55.     if (self.ammo_shells < 25)
  56.         parm4 = 25;
  57.     else
  58.         parm4 = self.ammo_shells;
  59.     parm5 = self.ammo_nails;
  60.     parm6 = self.ammo_rockets;
  61.     parm7 = self.ammo_cells;
  62.     parm8 = self.weapon;
  63.     parm9 = self.armortype * 100;
  64. };
  65.  
  66. void() SetNewParms =
  67. {
  68.     parm1 = IT_SHOTGUN | IT_AXE;
  69.  
  70. //MRB Changed from 100 to 150
  71.     parm2 = 150;
  72.     parm3 = 0;
  73.     parm4 = 25;
  74.     parm5 = 0;
  75.     parm6 = 0;
  76.     parm7 = 0;
  77.     parm8 = 1;
  78.     parm9 = 0;
  79. };
  80.  
  81. void() DecodeLevelParms =
  82. {
  83.     if (serverflags)
  84.     {
  85.         if (world.model == "maps/start.bsp")
  86.             SetNewParms ();        // take away all stuff on starting new episode
  87.     }
  88.     
  89.     self.items = parm1;
  90.     self.health = parm2;
  91.     self.armorvalue = parm3;
  92.     self.ammo_shells = parm4;
  93.     self.ammo_nails = parm5;
  94.     self.ammo_rockets = parm6;
  95.     self.ammo_cells = parm7;
  96.     self.weapon = parm8;
  97.     self.armortype = parm9 * 0.01;
  98. };
  99.  
  100. /*
  101. ============
  102. FindIntermission
  103.  
  104. Returns the entity to view from
  105. ============
  106. */
  107. entity() FindIntermission =
  108. {
  109.     local    entity spot;
  110.     local    float cyc;
  111.  
  112. // look for info_intermission first
  113.     spot = find (world, classname, "info_intermission");
  114.     if (spot)
  115.     {    // pick a random one
  116.         cyc = random() * 4;
  117.         while (cyc > 1)
  118.         {
  119.             spot = find (spot, classname, "info_intermission");
  120.             if (!spot)
  121.                 spot = find (spot, classname, "info_intermission");
  122.             cyc = cyc - 1;
  123.         }
  124.         return spot;
  125.     }
  126.  
  127. // then look for the start position
  128.     spot = find (world, classname, "info_player_start");
  129.     if (spot)
  130.         return spot;
  131.     
  132. // testinfo_player_start is only found in regioned levels
  133.     spot = find (world, classname, "testplayerstart");
  134.     if (spot)
  135.         return spot;
  136.     
  137.     objerror ("FindIntermission: no spot");
  138. };
  139.  
  140.  
  141. string nextmap;
  142. void() GotoNextMap =
  143. {
  144.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  145.         changelevel (mapname);
  146.     else
  147. /* LEVEL JUMBLER BY MRB*/
  148.  
  149.     {
  150.     if (mapname == "start")    nextmap = "e3m2";
  151.     if (mapname == "e3m2") nextmap = "e4m6";
  152.     if (mapname == "e4m6") nextmap = "e3m6";
  153.     if (mapname == "e3m6") nextmap = "e4m4";
  154.     if (mapname == "e4m4")    nextmap = "e2m7";
  155.     if (mapname == "e2m7") nextmap = "dm2";
  156.     if (mapname == "dm2")    nextmap = "e3m7";
  157.     if (mapname == "e3m7") nextmap = "e3m1";
  158.     if (mapname == "e3m1")    nextmap = "e1m4";
  159.     if (mapname == "e1m4")    nextmap = "e2m3";
  160.     if (mapname == "e2m3")    nextmap = "dm5";
  161.     if (mapname == "dm5")    nextmap = "e4m3";
  162.     if (mapname == "e4m3")    nextmap = "e1m3";
  163.     if (mapname == "e1m3")    nextmap = "e2m6";
  164.     if (mapname == "e2m6")    nextmap = "dm3";
  165.     if (mapname == "dm3")    nextmap = "e2m4";
  166.     if (mapname == "e2m4")    nextmap = "dm1";
  167.     if (mapname == "dm1")    nextmap = "e4m5";
  168.     if (mapname == "e4m5")    nextmap = "dm4";
  169.     if (mapname == "dm4")    nextmap = "e1m6";
  170.     if (mapname == "e1m6")    nextmap = "e4m2";
  171.     if (mapname == "e4m2")    nextmap = "e1m2";
  172.     if (mapname == "e1m2")    nextmap = "e4m7";
  173.     if (mapname == "e4m7") nextmap = "e1m7";
  174.     if (mapname == "e1m7")    nextmap = "e2m5";
  175.     if (mapname == "e2m5") nextmap = "e1m1";
  176.     if (mapname == "e1m1") nextmap = "e2m1";
  177.     if (mapname == "e2m1")    nextmap = "dm6";
  178.     if (mapname == "dm6")    nextmap = "e3m3";
  179.     if (mapname == "e3m3")    nextmap = "e1m5";
  180.     if (mapname == "e1m5")    nextmap = "e2m2";
  181.     if (mapname == "e2m2")    nextmap = "e4m8";
  182.     if (mapname == "e4m8") nextmap = "start";
  183.  
  184. /* Maps not-good for DM:     e1m8 (no gravity - too "tall"),  
  185.                 e2m6 (dismal obliete - keep getting lost),
  186.                 e3m4 (platforms)
  187.                 e4m1 (too much water)
  188.                 e3m5 (wind-tunnels)            
  189.                 end  (too much lava)            */
  190.  
  191.         changelevel (nextmap);
  192.     }
  193. };
  194.  
  195.  
  196. void() ExitIntermission =
  197. {
  198. // skip any text in deathmatch
  199.     if (deathmatch)
  200.     {
  201.         GotoNextMap ();
  202.         return;
  203.     }
  204.     
  205.     intermission_exittime = time + 1;
  206.     intermission_running = intermission_running + 1;
  207.  
  208. //
  209. // run some text if at the end of an episode
  210. //
  211.     if (intermission_running == 2)
  212.     {
  213.         if (world.model == "maps/e1m7.bsp")
  214.         {
  215.             WriteByte (MSG_ALL, SVC_CDTRACK);
  216.             WriteByte (MSG_ALL, 2);
  217.             WriteByte (MSG_ALL, 3);
  218.             if (!cvar("registered"))
  219.             {
  220.                 WriteByte (MSG_ALL, SVC_FINALE);
  221.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  222.             }
  223.             else
  224.             {
  225.                 WriteByte (MSG_ALL, SVC_FINALE);
  226.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  227.             }
  228.             return;
  229.         }
  230.         else if (world.model == "maps/e2m6.bsp")
  231.         {
  232.             WriteByte (MSG_ALL, SVC_CDTRACK);
  233.             WriteByte (MSG_ALL, 2);
  234.             WriteByte (MSG_ALL, 3);
  235.  
  236.             WriteByte (MSG_ALL, SVC_FINALE);
  237.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  238.             return;
  239.         }
  240.         else if (world.model == "maps/e3m6.bsp")
  241.         {
  242.             WriteByte (MSG_ALL, SVC_CDTRACK);
  243.             WriteByte (MSG_ALL, 2);
  244.             WriteByte (MSG_ALL, 3);
  245.  
  246.             WriteByte (MSG_ALL, SVC_FINALE);
  247.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  248.             return;
  249.         }
  250.         else if (world.model == "maps/e4m7.bsp")
  251.         {
  252.             WriteByte (MSG_ALL, SVC_CDTRACK);
  253.             WriteByte (MSG_ALL, 2);
  254.             WriteByte (MSG_ALL, 3);
  255.  
  256.             WriteByte (MSG_ALL, SVC_FINALE);
  257.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  258.             return;
  259.         }
  260.  
  261.         GotoNextMap();
  262.     }
  263.     
  264.     if (intermission_running == 3)
  265.     {
  266.         if (!cvar("registered"))
  267.         {    // shareware episode has been completed, go to sell screen
  268.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  269.             return;
  270.         }
  271.         
  272.         if ( (serverflags&15) == 15)
  273.         {
  274.             WriteByte (MSG_ALL, SVC_FINALE);
  275.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  276.             return;
  277.         }
  278.         
  279.     }
  280.  
  281.     GotoNextMap();
  282. };
  283.  
  284. /*
  285. ============
  286. IntermissionThink
  287.  
  288. When the player presses attack or jump, change to the next level
  289. ============
  290. */
  291. void() IntermissionThink =
  292. {
  293.     if (time < intermission_exittime)
  294.         return;
  295.  
  296.     if (!self.button0 && !self.button1 && !self.button2)
  297.         return;
  298.     
  299.     ExitIntermission ();
  300. };
  301.  
  302. void() execute_changelevel =
  303. {
  304.     local entity    pos;
  305.  
  306.     intermission_running = 1;
  307.     
  308. // enforce a wait time before allowing changelevel
  309.     if (deathmatch)
  310.         intermission_exittime = time + 5;
  311.     else
  312.         intermission_exittime = time + 2;
  313.  
  314.     WriteByte (MSG_ALL, SVC_CDTRACK);
  315.     WriteByte (MSG_ALL, 3);
  316.     WriteByte (MSG_ALL, 3);
  317.     
  318.     pos = FindIntermission ();
  319.  
  320.     other = find (world, classname, "player");
  321.     while (other != world)
  322.     {
  323.         other.view_ofs = '0 0 0';
  324.         other.angles = other.v_angle = pos.mangle;
  325.         other.fixangle = TRUE;        // turn this way immediately
  326.         other.nextthink = time + 0.5;
  327.         other.takedamage = DAMAGE_NO;
  328.         other.solid = SOLID_NOT;
  329.         other.movetype = MOVETYPE_NONE;
  330.         other.modelindex = 0;
  331.         setorigin (other, pos.origin);
  332.         other = find (other, classname, "player");
  333.     }    
  334.  
  335.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  336. };
  337.  
  338.  
  339. void() changelevel_touch =
  340. {
  341.     local entity    pos;
  342.  
  343.     if (other.classname != "player")
  344.         return;
  345.  
  346.     if (cvar("noexit"))
  347.     {
  348.         T_Damage (other, self, self, 50000);
  349.         return;
  350.     }
  351.     bprint (other.netname);
  352.     bprint (" exited the level\n");
  353.     
  354.     nextmap = self.map;
  355.  
  356.     SUB_UseTargets ();
  357.  
  358.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  359.     {    // NO_INTERMISSION
  360.         GotoNextMap();
  361.         return;
  362.     }
  363.     
  364.     self.touch = SUB_Null;
  365.  
  366. // we can't move people right now, because touch functions are called
  367. // in the middle of C movement code, so set a think time to do it
  368.     self.think = execute_changelevel;
  369.     self.nextthink = time + 0.1;
  370. };
  371.  
  372. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  373. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  374. */
  375. void() trigger_changelevel =
  376. {
  377.     if (!self.map)
  378.         objerror ("chagnelevel trigger doesn't have map");
  379.     
  380.     InitTrigger ();
  381.     self.touch = changelevel_touch;
  382. };
  383.  
  384.  
  385. /*
  386. =============================================================================
  387.  
  388.                 PLAYER GAME EDGE FUNCTIONS
  389.  
  390. =============================================================================
  391. */
  392.  
  393. void() set_suicide_frame;
  394.  
  395. // called by ClientKill and DeadThink
  396. void() respawn =
  397. {
  398.     if (coop)
  399.     {
  400.         // make a copy of the dead body for appearances sake
  401.         CopyToBodyQue (self);
  402.         // get the spawn parms as they were at level start
  403.         setspawnparms (self);
  404.         // respawn        
  405.         PutClientInServer ();
  406.     }
  407.     else if (deathmatch)
  408.     {
  409.         // make a copy of the dead body for appearances sake
  410.         CopyToBodyQue (self);
  411.         // set default spawn parms
  412.         SetNewParms ();
  413.         // respawn        
  414.         PutClientInServer ();
  415.     }
  416.     else
  417.     {    // restart the entire server
  418.         localcmd ("restart\n");
  419.     }
  420. };
  421.  
  422.  
  423. /*
  424. ============
  425. ClientKill
  426.  
  427. Player entered the suicide command
  428. ============
  429. */
  430. void() ClientKill =
  431. {
  432.     bprint (self.netname);
  433.     bprint (" suicides\n");
  434.     set_suicide_frame ();
  435.     self.modelindex = modelindex_player;
  436.     self.frags = self.frags - 2;    // extra penalty
  437.     respawn ();
  438. };
  439.  
  440. float(vector v) CheckSpawnPoint =
  441. {
  442.     return FALSE;
  443. };
  444.  
  445. /*
  446. ============
  447. SelectSpawnPoint
  448.  
  449. Returns the entity to spawn at
  450. ============
  451. */
  452. entity() SelectSpawnPoint =
  453. {
  454.     local    entity spot;
  455.     
  456. // testinfo_player_start is only found in regioned levels
  457.     spot = find (world, classname, "testplayerstart");
  458.     if (spot)
  459.         return spot;
  460.         
  461. // choose a info_player_deathmatch point
  462.     if (coop)
  463.     {
  464.         lastspawn = find(lastspawn, classname, "info_player_coop");
  465.         if (lastspawn == world)
  466.             lastspawn = find (lastspawn, classname, "info_player_start");
  467.         if (lastspawn != world)
  468.             return lastspawn;
  469.     }
  470.     else if (deathmatch)
  471.     {
  472.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  473.         if (lastspawn == world)
  474.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  475.         if (lastspawn != world)
  476.             return lastspawn;
  477.     }
  478.  
  479.     if (serverflags)
  480.     {    // return with a rune to start
  481.         spot = find (world, classname, "info_player_start2");
  482.         if (spot)
  483.             return spot;
  484.     }
  485.     
  486.     spot = find (world, classname, "info_player_start");
  487.     if (!spot)
  488.         error ("PutClientInServer: no info_player_start on level");
  489.     
  490.     return spot;
  491. };
  492.  
  493. /*
  494. ===========
  495. PutClientInServer
  496.  
  497. called each time a player is spawned
  498. ============
  499. */
  500. void() DecodeLevelParms;
  501. void() PlayerDie;
  502.  
  503.  
  504. void() PutClientInServer =
  505. {
  506.     local    entity spot;
  507.  
  508.     self.classname = "player";
  509. //MRB Changed from 100 to 150
  510.     self.health = 150;
  511.     self.takedamage = DAMAGE_AIM;
  512.     self.solid = SOLID_SLIDEBOX;
  513.     self.movetype = MOVETYPE_WALK;
  514.     self.show_hostile = 0;
  515. //MRB Changed from 100 to 150
  516.     self.max_health = 150;
  517.     self.flags = FL_CLIENT;
  518.     self.air_finished = time + 12;
  519.     self.dmg = 2;           // initial water damage
  520.     self.super_damage_finished = 0;
  521.     self.radsuit_finished = 0;
  522.     self.invisible_finished = 0;
  523.     self.invincible_finished = 0;
  524.     self.effects = 0;
  525.     self.invincible_time = 0;
  526.  
  527.     DecodeLevelParms ();
  528.     
  529.     W_SetCurrentAmmo ();
  530.  
  531.     self.attack_finished = time;
  532.     self.th_pain = player_pain;
  533.     self.th_die = PlayerDie;
  534.     
  535.     self.deadflag = DEAD_NO;
  536. // paustime is set by teleporters to keep the player from moving a while
  537.     self.pausetime = 0;
  538.     
  539.     spot = SelectSpawnPoint ();
  540.  
  541.     self.origin = spot.origin + '0 0 1';
  542.     self.angles = spot.angles;
  543.     self.fixangle = TRUE;        // turn this way immediately
  544.  
  545. // oh, this is a hack!
  546.     setmodel (self, "progs/eyes.mdl");
  547.     modelindex_eyes = self.modelindex;
  548.  
  549.     setmodel (self, "progs/player.mdl");
  550.     modelindex_player = self.modelindex;
  551.  
  552.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  553.     
  554.     self.view_ofs = '0 0 22';
  555.  
  556.     player_stand1 ();
  557.     
  558.     if (deathmatch || coop)
  559.     {
  560.         makevectors(self.angles);
  561.         spawn_tfog (self.origin + v_forward*20);
  562.     }
  563.  
  564.     spawn_tdeath (self.origin, self);
  565. };
  566.  
  567.  
  568. /*
  569. =============================================================================
  570.  
  571.                 QUAKED FUNCTIONS
  572.  
  573. =============================================================================
  574. */
  575.  
  576.  
  577. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  578. The normal starting point for a level.
  579. */
  580. void() info_player_start =
  581. {
  582. };
  583.  
  584.  
  585. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  586. Only used on start map for the return point from an episode.
  587. */
  588. void() info_player_start2 =
  589. {
  590. };
  591.  
  592.  
  593. /*
  594. saved out by quaked in region mode
  595. */
  596. void() testplayerstart =
  597. {
  598. };
  599.  
  600. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  601. potential spawning position for deathmatch games
  602. */
  603. void() info_player_deathmatch =
  604. {
  605. };
  606.  
  607. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  608. potential spawning position for coop games
  609. */
  610. void() info_player_coop =
  611. {
  612. };
  613.  
  614. /*
  615. ===============================================================================
  616.  
  617. RULES
  618.  
  619. ===============================================================================
  620. */
  621.  
  622. /*
  623. go to the next level for deathmatch
  624. only called if a time or frag limit has expired
  625. */
  626. void() NextLevel =
  627. {
  628.     local entity o;
  629.  
  630.     if (mapname == "start")
  631.     {
  632.         if (!cvar("registered"))
  633.         {
  634.             mapname = "e1m1";
  635.         }
  636.         else if (!(serverflags & 1))
  637.         {
  638.             mapname = "e1m1";
  639.             serverflags = serverflags + 1;
  640.         }
  641.         else if (!(serverflags & 2))
  642.         {
  643.             mapname = "e2m1";
  644.             serverflags = serverflags + 2;
  645.         }
  646.         else if (!(serverflags & 4))
  647.         {
  648.             mapname = "e3m1";
  649.             serverflags = serverflags + 4;
  650.         }
  651.         else if (!(serverflags & 8))
  652.         {
  653.             mapname = "e4m1";
  654.             serverflags = serverflags + 8;
  655.         }
  656.         else
  657.         {
  658.             mapname = "start";
  659.             serverflags = serverflags - 15;
  660.         }
  661.  
  662.         o = spawn();
  663.         o.map = mapname;
  664.     }
  665.     else
  666.     {
  667.         // find a trigger changelevel
  668.         o = find(world, classname, "trigger_changelevel");
  669.  
  670.         // go back to start if no trigger_changelevel
  671.         if (!o)
  672.         {
  673.             mapname = "start";
  674.             o = spawn();
  675.             o.map = mapname;
  676.         }
  677.     }
  678.  
  679.     nextmap = o.map;
  680.     gameover = TRUE;
  681.     
  682.     if (o.nextthink < time)
  683.     {
  684.         o.think = execute_changelevel;
  685.         o.nextthink = time + 0.1;
  686.     }
  687. };
  688.  
  689. /*
  690. ============
  691. CheckRules
  692.  
  693. Exit deathmatch games upon conditions
  694. ============
  695. */
  696. void() CheckRules =
  697. {
  698.     local    float        timelimit;
  699.     local    float        fraglimit;
  700.     
  701.     if (gameover)    // someone else quit the game already
  702.         return;
  703.         
  704.     timelimit = cvar("timelimit") * 60;
  705.     fraglimit = cvar("fraglimit");
  706.     
  707.     if (timelimit && time >= timelimit)
  708.     {
  709.         NextLevel ();
  710.         return;
  711.     }
  712.     
  713.     if (fraglimit && self.frags >= fraglimit)
  714.     {
  715.         NextLevel ();
  716.         return;
  717.     }    
  718. };
  719.  
  720. //============================================================================
  721.  
  722. void() PlayerDeathThink =
  723. {
  724.     local entity    old_self;
  725.     local float        forward;
  726.  
  727.     if ((self.flags & FL_ONGROUND))
  728.     {
  729.         forward = vlen (self.velocity);
  730.         forward = forward - 20;
  731.         if (forward <= 0)
  732.             self.velocity = '0 0 0';
  733.         else    
  734.             self.velocity = forward * normalize(self.velocity);
  735.     }
  736.  
  737. // wait for all buttons released
  738.     if (self.deadflag == DEAD_DEAD)
  739.     {
  740.         if (self.button2 || self.button1 || self.button0)
  741.             return;
  742.         self.deadflag = DEAD_RESPAWNABLE;
  743.         return;
  744.     }
  745.  
  746. // wait for any button down
  747.     if (!self.button2 && !self.button1 && !self.button0)
  748.         return;
  749.  
  750.     self.button0 = 0;
  751.     self.button1 = 0;
  752.     self.button2 = 0;
  753.     respawn();
  754. };
  755.  
  756.  
  757. void() PlayerJump =
  758. {
  759.     local vector start, end;
  760.     
  761.     if (self.flags & FL_WATERJUMP)
  762.         return;
  763.     
  764.     if (self.waterlevel >= 2)
  765.     {
  766.         if (self.watertype == CONTENT_WATER)
  767.             self.velocity_z = 100;
  768.         else if (self.watertype == CONTENT_SLIME)
  769.             self.velocity_z = 80;
  770.         else
  771.             self.velocity_z = 50;
  772.  
  773. // play swiming sound
  774.         if (self.swim_flag < time)
  775.         {
  776.             self.swim_flag = time + 1;
  777.             if (random() < 0.5)
  778.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  779.             else
  780.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  781.         }
  782.  
  783.         return;
  784.     }
  785.  
  786.     if (!(self.flags & FL_ONGROUND))
  787.         return;
  788.  
  789.     if ( !(self.flags & FL_JUMPRELEASED) )
  790.         return;        // don't pogo stick
  791.  
  792.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  793.  
  794.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  795.     
  796.     self.button2 = 0;
  797. // player jumping sound
  798.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  799.     self.velocity_z = self.velocity_z + 270;
  800. };
  801.  
  802.  
  803. /*
  804. ===========
  805. WaterMove
  806.  
  807. ============
  808. */
  809. .float    dmgtime;
  810.  
  811. void() WaterMove =
  812. {
  813. //dprint (ftos(self.waterlevel));
  814.     if (self.movetype == MOVETYPE_NOCLIP)
  815.         return;
  816.     if (self.health < 0)
  817.         return;
  818.  
  819.     if (self.waterlevel != 3)
  820.     {
  821.         if (self.air_finished < time)
  822.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  823.         else if (self.air_finished < time + 9)
  824.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  825.         self.air_finished = time + 12;
  826.         self.dmg = 2;
  827.     }
  828.     else if (self.air_finished < time)
  829.     {    // drown!
  830.         if (self.pain_finished < time)
  831.         {
  832.             self.dmg = self.dmg + 2;
  833.             if (self.dmg > 15)
  834.                 self.dmg = 10;
  835.             T_Damage (self, world, world, self.dmg);
  836.             self.pain_finished = time + 1;
  837.         }
  838.     }
  839.     
  840.     if (!self.waterlevel)
  841.     {
  842.         if (self.flags & FL_INWATER)
  843.         {    
  844.             // play leave water sound
  845.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  846.             self.flags = self.flags - FL_INWATER;
  847.         }
  848.         return;
  849.     }
  850.  
  851.     if (self.watertype == CONTENT_LAVA)
  852.     {    // do damage
  853.         if (self.dmgtime < time)
  854.         {
  855.             if (self.radsuit_finished > time)
  856.                 self.dmgtime = time + 1;
  857.             else
  858.                 self.dmgtime = time + 0.2;
  859.  
  860.             T_Damage (self, world, world, 10*self.waterlevel);
  861.         }
  862.     }
  863.     else if (self.watertype == CONTENT_SLIME)
  864.     {    // do damage
  865.         if (self.dmgtime < time && self.radsuit_finished < time)
  866.         {
  867.             self.dmgtime = time + 1;
  868.             T_Damage (self, world, world, 4*self.waterlevel);
  869.         }
  870.     }
  871.     
  872.     if ( !(self.flags & FL_INWATER) )
  873.     {    
  874.  
  875. // player enter water sound
  876.  
  877.         if (self.watertype == CONTENT_LAVA)
  878.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  879.         if (self.watertype == CONTENT_WATER)
  880.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  881.         if (self.watertype == CONTENT_SLIME)
  882.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  883.  
  884.         self.flags = self.flags + FL_INWATER;
  885.         self.dmgtime = 0;
  886.     }
  887.     
  888.     if (! (self.flags & FL_WATERJUMP) )
  889.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  890. };
  891.  
  892. void() CheckWaterJump =
  893. {
  894.     local vector start, end;
  895.  
  896. // check for a jump-out-of-water
  897.     makevectors (self.angles);
  898.     start = self.origin;
  899.     start_z = start_z + 8; 
  900.     v_forward_z = 0;
  901.     normalize(v_forward);
  902.     end = start + v_forward*24;
  903.     traceline (start, end, TRUE, self);
  904.     if (trace_fraction < 1)
  905.     {    // solid at waist
  906.         start_z = start_z + self.maxs_z - 8;
  907.         end = start + v_forward*24;
  908.         self.movedir = trace_plane_normal * -50;
  909.         traceline (start, end, TRUE, self);
  910.         if (trace_fraction == 1)
  911.         {    // open at eye level
  912.             self.flags = self.flags | FL_WATERJUMP;
  913.             self.velocity_z = 225;
  914.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  915.             self.teleport_time = time + 2;    // safety net
  916.             return;
  917.         }
  918.     }
  919. };
  920.  
  921.  
  922. /*
  923. ================
  924. PlayerPreThink
  925.  
  926. Called every frame before physics are run
  927. ================
  928. */
  929. void() PlayerPreThink =
  930. {
  931.     local    float    mspeed, aspeed;
  932.     local    float    r;
  933.  
  934.     if (intermission_running)
  935.     {
  936.         IntermissionThink ();    // otherwise a button could be missed between
  937.         return;                    // the think tics
  938.     }
  939.  
  940.     if (self.view_ofs == '0 0 0')
  941.         return;        // intermission or finale
  942.  
  943.     makevectors (self.v_angle);        // is this still used
  944.  
  945.     CheckRules ();
  946.     WaterMove ();
  947.  
  948.     if (self.waterlevel == 2)
  949.         CheckWaterJump ();
  950.  
  951.     if (self.deadflag >= DEAD_DEAD)
  952.     {
  953.         PlayerDeathThink ();
  954.         return;
  955.     }
  956.     
  957.     if (self.deadflag == DEAD_DYING)
  958.         return;    // dying, so do nothing
  959.  
  960.     if (self.button2)
  961.     {
  962.         PlayerJump ();
  963.     }
  964.     else
  965.         self.flags = self.flags | FL_JUMPRELEASED;
  966.  
  967. // teleporters can force a non-moving pause time    
  968.     if (time < self.pausetime)
  969.         self.velocity = '0 0 0';
  970.  
  971. //NEW CAMPER KILL MRB
  972.     CheckForCamper();
  973. };
  974.     
  975. /*
  976. ================
  977. CheckPowerups
  978.  
  979. Check for turning off powerups
  980. ================
  981. */
  982. void() CheckPowerups =
  983. {
  984.     if (self.health <= 0)
  985.         return;
  986.  
  987. // invisibility
  988.     if (self.invisible_finished)
  989.     {
  990. // sound and screen flash when items starts to run out
  991.         if (self.invisible_sound < time)
  992.         {
  993.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  994.             self.invisible_sound = time + ((random() * 3) + 1);
  995.         }
  996.  
  997.  
  998.         if (self.invisible_finished < time + 3)
  999.         {
  1000.             if (self.invisible_time == 1)
  1001.             {
  1002.                 sprint (self, "Ring of Shadows magic is fading\n");
  1003.                 stuffcmd (self, "bf\n");
  1004.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1005.                 self.invisible_time = time + 1;
  1006.             }
  1007.             
  1008.             if (self.invisible_time < time)
  1009.             {
  1010.                 self.invisible_time = time + 1;
  1011.                 stuffcmd (self, "bf\n");
  1012.             }
  1013.         }
  1014.  
  1015.         if (self.invisible_finished < time)
  1016.         {    // just stopped
  1017.             self.items = self.items - IT_INVISIBILITY;
  1018.             self.invisible_finished = 0;
  1019.             self.invisible_time = 0;
  1020.         }
  1021.         
  1022.     // use the eyes
  1023.         self.frame = 0;
  1024.         self.modelindex = modelindex_eyes;
  1025.     }
  1026.     else
  1027.         self.modelindex = modelindex_player;    // don't use eyes
  1028.  
  1029. // invincibility
  1030.     if (self.invincible_finished)
  1031.     {
  1032. // sound and screen flash when items starts to run out
  1033.         if (self.invincible_finished < time + 3)
  1034.         {
  1035.             if (self.invincible_time == 1)
  1036.             {
  1037.                 sprint (self, "Protection is almost burned out\n");
  1038.                 stuffcmd (self, "bf\n");
  1039.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1040.                 self.invincible_time = time + 1;
  1041.             }
  1042.             
  1043.             if (self.invincible_time < time)
  1044.             {
  1045.                 self.invincible_time = time + 1;
  1046.                 stuffcmd (self, "bf\n");
  1047.             }
  1048.         }
  1049.         
  1050.         if (self.invincible_finished < time)
  1051.         {    // just stopped
  1052.             self.items = self.items - IT_INVULNERABILITY;
  1053.             self.invincible_time = 0;
  1054.             self.invincible_finished = 0;
  1055.         }
  1056.         if (self.invincible_finished > time)
  1057.             self.effects = self.effects | EF_DIMLIGHT;
  1058.         else
  1059.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1060.     }
  1061.  
  1062. // super damage
  1063.     if (self.super_damage_finished)
  1064.     {
  1065.  
  1066. // sound and screen flash when items starts to run out
  1067.  
  1068.         if (self.super_damage_finished < time + 3)
  1069.         {
  1070.             if (self.super_time == 1)
  1071.             {
  1072.                 sprint (self, "Quad Damage is wearing off\n");
  1073.                 stuffcmd (self, "bf\n");
  1074.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1075.                 self.super_time = time + 1;
  1076.             }      
  1077.             
  1078.             if (self.super_time < time)
  1079.             {
  1080.                 self.super_time = time + 1;
  1081.                 stuffcmd (self, "bf\n");
  1082.             }
  1083.         }
  1084.  
  1085.         if (self.super_damage_finished < time)
  1086.         {    // just stopped
  1087.             self.items = self.items - IT_QUAD;
  1088.             self.super_damage_finished = 0;
  1089.             self.super_time = 0;
  1090.         }
  1091.         if (self.super_damage_finished > time)
  1092.             self.effects = self.effects | EF_DIMLIGHT;
  1093.         else
  1094.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1095.     }    
  1096.  
  1097. // suit    
  1098.     if (self.radsuit_finished)
  1099.     {
  1100.         self.air_finished = time + 12;        // don't drown
  1101.  
  1102. // sound and screen flash when items starts to run out
  1103.         if (self.radsuit_finished < time + 3)
  1104.         {
  1105.             if (self.rad_time == 1)
  1106.             {
  1107.                 sprint (self, "Air supply in Biosuit expiring\n");
  1108.                 stuffcmd (self, "bf\n");
  1109.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1110.                 self.rad_time = time + 1;
  1111.             }
  1112.             
  1113.             if (self.rad_time < time)
  1114.             {
  1115.                 self.rad_time = time + 1;
  1116.                 stuffcmd (self, "bf\n");
  1117.             }
  1118.         }
  1119.  
  1120.         if (self.radsuit_finished < time)
  1121.         {    // just stopped
  1122.             self.items = self.items - IT_SUIT;
  1123.             self.rad_time = 0;
  1124.             self.radsuit_finished = 0;
  1125.         }
  1126.     }    
  1127.  
  1128. };
  1129.  
  1130.  
  1131. /*
  1132. ================
  1133. PlayerPostThink
  1134.  
  1135. Called every frame after physics are run
  1136. ================
  1137. */
  1138. void() PlayerPostThink =
  1139. {
  1140.     local    float    mspeed, aspeed;
  1141.     local    float    r;
  1142.  
  1143.     if (self.view_ofs == '0 0 0')
  1144.         return;        // intermission or finale
  1145.     if (self.deadflag)
  1146.         return;
  1147.         
  1148. // do weapon stuff
  1149.  
  1150.     W_WeaponFrame ();
  1151.  
  1152. // check to see if player landed and play landing sound    
  1153.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1154.     {
  1155.         if (self.watertype == CONTENT_WATER)
  1156.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1157.         else if (self.jump_flag < -650)
  1158.         {
  1159.             T_Damage (self, world, world, 5); 
  1160.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1161.             self.deathtype = "falling";
  1162.         }
  1163.         else
  1164.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1165.  
  1166.         self.jump_flag = 0;
  1167.     }
  1168.  
  1169.     if (!(self.flags & FL_ONGROUND))
  1170.         self.jump_flag = self.velocity_z;
  1171.  
  1172.     CheckPowerups ();
  1173. };
  1174.  
  1175.  
  1176. /*
  1177. ===========
  1178. ClientConnect
  1179.  
  1180. called when a player connects to a server
  1181. ============
  1182. */
  1183. void() ClientConnect =
  1184. {
  1185.     bprint (self.netname);
  1186.     bprint (" entered the game\n");
  1187.     
  1188. // a client connecting during an intermission can cause problems
  1189.     if (intermission_running)
  1190.         ExitIntermission ();
  1191. };
  1192.  
  1193.  
  1194. /*
  1195. ===========
  1196. ClientDisconnect
  1197.  
  1198. called when a player disconnects from a server
  1199. ============
  1200. */
  1201. void() ClientDisconnect =
  1202. {
  1203.     if (gameover)
  1204.         return;
  1205.     // if the level end trigger has been activated, just return
  1206.     // since they aren't *really* leaving
  1207.  
  1208.     // let everyone else know
  1209.     bprint (self.netname);
  1210.     bprint (" left the game with ");
  1211.     bprint (ftos(self.frags));
  1212.     bprint (" frags\n");
  1213.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1214.     set_suicide_frame ();
  1215. };
  1216.  
  1217. /*
  1218. ===========
  1219. ClientObituary
  1220.  
  1221. called when a player dies
  1222. ============
  1223. */
  1224. void(entity targ, entity attacker) ClientObituary =
  1225. {
  1226.     local    float rnum;
  1227.     local    string deathstring, deathstring2;
  1228.     rnum = random();
  1229.  
  1230.     if (targ.classname == "player")
  1231.     {
  1232.         if (attacker.classname == "teledeath")
  1233.         {
  1234.             bprint (targ.netname);
  1235.             bprint (" was telefragged by ");
  1236.             bprint (attacker.owner.netname);
  1237.             bprint ("\n");
  1238.  
  1239.             attacker.owner.frags = attacker.owner.frags + 1;
  1240.             return;
  1241.         }
  1242.  
  1243.         if (attacker.classname == "teledeath2")
  1244.         {
  1245.             bprint ("Satan's power deflects ");
  1246.             bprint (targ.netname);
  1247.             bprint ("'s telefrag\n");
  1248.  
  1249.             targ.frags = targ.frags - 1;
  1250.             return;
  1251.         }
  1252.  
  1253.         if (attacker.classname == "player")
  1254.         {
  1255.             if (targ == attacker)
  1256.             {
  1257.                 // killed self
  1258.                 attacker.frags = attacker.frags - 1;
  1259.                 bprint (targ.netname);
  1260.                 
  1261.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1262.                 {
  1263.                     bprint (" discharges into the water.\n");
  1264.                     return;
  1265.                 }
  1266.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1267.                     bprint (" tries to put the pin back in\n");
  1268.                 else
  1269.                     bprint (" becomes bored with life\n");
  1270.                 return;
  1271.             }
  1272.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1273.             {
  1274.                 if (rnum < 0.25)
  1275.                     deathstring = " mows down a teammate\n";
  1276.                 else if (rnum < 0.50)
  1277.                     deathstring = " checks his glasses\n";
  1278.                 else if (rnum < 0.75)
  1279.                     deathstring = " gets a frag for the other team\n";
  1280.                 else
  1281.                     deathstring = " loses another friend\n";
  1282.                 bprint (attacker.netname);
  1283.                 bprint (deathstring);
  1284.                 attacker.frags = attacker.frags - 1;
  1285.                 return;
  1286.             }
  1287.             else
  1288.             {
  1289.                 attacker.frags = attacker.frags + 1;
  1290.  
  1291.                 rnum = attacker.weapon;
  1292.                 if (rnum == IT_AXE)
  1293.                 {
  1294.                     deathstring = " was ax-murdered by ";
  1295.                     deathstring2 = "\n";
  1296.                 }
  1297.                 if (rnum == IT_SHOTGUN)
  1298.                 {
  1299.                     deathstring = " chewed on ";
  1300.                     deathstring2 = "'s boomstick\n";
  1301.                 }
  1302.                 if (rnum == IT_SUPER_SHOTGUN)
  1303.                 {
  1304.                     deathstring = " ate 2 loads of ";
  1305.                     deathstring2 = "'s buckshot\n";
  1306.                 }
  1307.                 if (rnum == IT_NAILGUN)
  1308.                 {
  1309.                     deathstring = " was nailed by ";
  1310.                     deathstring2 = "\n";
  1311.                 }
  1312.                 if (rnum == IT_SUPER_NAILGUN)
  1313.                 {
  1314.                     deathstring = " was punctured by ";
  1315.                     deathstring2 = "\n";
  1316.                 }
  1317.                 if (rnum == IT_GRENADE_LAUNCHER)
  1318.                 {
  1319.                     deathstring = " eats ";
  1320.                     deathstring2 = "'s pineapple\n";
  1321.                     if (targ.health < -40)
  1322.                     {
  1323.                         deathstring = " was gibbed by ";
  1324.                         deathstring2 = "'s grenade\n";
  1325.                     }
  1326.                 }
  1327.                 if (rnum == IT_ROCKET_LAUNCHER)
  1328.                 {
  1329.                     deathstring = " rides ";
  1330.                     deathstring2 = "'s rocket\n";
  1331.                     if (targ.health < -40)
  1332.                     {
  1333.                         deathstring = " was gibbed by ";
  1334.                         deathstring2 = "'s rocket\n" ;
  1335.                     }
  1336.                 }
  1337.                 if (rnum == IT_LIGHTNING)
  1338.                 {
  1339.                     deathstring = " accepts ";
  1340.                     if (attacker.waterlevel > 1)
  1341.                         deathstring2 = "'s discharge\n";
  1342.                     else
  1343.                         deathstring2 = "'s shaft\n";
  1344.                 }
  1345.                 bprint (targ.netname);
  1346.                 bprint (deathstring);
  1347.                 bprint (attacker.netname);
  1348.                 bprint (deathstring2);
  1349.             }
  1350.             return;
  1351.         }
  1352.         else
  1353.         {
  1354.             targ.frags = targ.frags - 1;
  1355.             bprint (targ.netname);
  1356.  
  1357.             // killed by a montser?
  1358.             if (attacker.flags & FL_MONSTER)
  1359.             {
  1360.                 if (attacker.classname == "monster_army")
  1361.                     bprint (" was shot by a Grunt\n");
  1362.                 if (attacker.classname == "monster_demon1")
  1363.                     bprint (" was eviscerated by a Fiend\n");
  1364.                 if (attacker.classname == "monster_dog")
  1365.                     bprint (" was mauled by a Rottweiler\n");
  1366.                 if (attacker.classname == "monster_dragon")
  1367.                     bprint (" was fried by a Dragon\n");
  1368.                 if (attacker.classname == "monster_enforcer")
  1369.                     bprint (" was blasted by an Enforcer\n");
  1370.                 if (attacker.classname == "monster_fish")
  1371.                     bprint (" was fed to the Rotfish\n");
  1372.                 if (attacker.classname == "monster_hell_knight")
  1373.                     bprint (" was slain by a Death Knight\n");
  1374.                 if (attacker.classname == "monster_knight")
  1375.                     bprint (" was slashed by a Knight\n");
  1376.                 if (attacker.classname == "monster_ogre")
  1377.                     bprint (" was destroyed by an Ogre\n");
  1378.                 if (attacker.classname == "monster_oldone")
  1379.                     bprint (" became one with Shub-Niggurath\n");
  1380.                 if (attacker.classname == "monster_shalrath")
  1381.                     bprint (" was exploded by a Vore\n");
  1382.                 if (attacker.classname == "monster_shambler")
  1383.                     bprint (" was smashed by a Shambler\n");
  1384.                 if (attacker.classname == "monster_tarbaby")
  1385.                     bprint (" was slimed by a Spawn\n");
  1386.                 if (attacker.classname == "monster_vomit")
  1387.                     bprint (" was vomited on by a Vomitus\n");
  1388.                 if (attacker.classname == "monster_wizard")
  1389.                     bprint (" was scragged by a Scrag\n");
  1390.                 if (attacker.classname == "monster_zombie")
  1391.                     bprint (" joins the Zombies\n");
  1392.  
  1393.                 return;
  1394.             }
  1395.  
  1396.             // tricks and traps
  1397.             if (attacker.classname == "explo_box")
  1398.             {
  1399.                 bprint (" blew up\n");
  1400.                 return;
  1401.             }
  1402.             if (attacker.solid == SOLID_BSP && attacker != world)
  1403.             {    
  1404.                 bprint (" was squished\n");
  1405.                 return;
  1406.             }
  1407.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1408.             {
  1409.                 bprint (" was spiked\n");
  1410.                 return;
  1411.             }
  1412.             if (attacker.classname == "fireball")
  1413.             {
  1414.                 bprint (" ate a lavaball\n");
  1415.                 return;
  1416.             }
  1417.             if (attacker.classname == "trigger_changelevel")
  1418.             {
  1419.                 bprint (" tried to leave\n");
  1420.                 return;
  1421.             }
  1422.  
  1423.             // in-water deaths
  1424.             rnum = targ.watertype;
  1425.             if (rnum == -3)
  1426.             {
  1427.                 if (random() < 0.5)
  1428.                     bprint (" sleeps with the fishes\n");
  1429.                 else
  1430.                     bprint (" sucks it down\n");
  1431.                 return;
  1432.             }
  1433.             else if (rnum == -4)
  1434.             {
  1435.                 if (random() < 0.5)
  1436.                     bprint (" gulped a load of slime\n");
  1437.                 else
  1438.                     bprint (" can't exist on slime alone\n");
  1439.                 return;
  1440.             }
  1441.             else if (rnum == -5)
  1442.             {
  1443.                 if (targ.health < -15)
  1444.                 {
  1445.                     bprint (" burst into flames\n");
  1446.                     return;
  1447.                 }
  1448.                 if (random() < 0.5)
  1449.                     bprint (" turned into hot slag\n");
  1450.                 else
  1451.                     bprint (" visits the Volcano God\n");
  1452.                 return;
  1453.             }
  1454.  
  1455.             // fell to their death?
  1456.             if (targ.deathtype == "falling")
  1457.             {
  1458.                 targ.deathtype = "";
  1459.                 bprint (" fell to his death\n");
  1460.                 return;
  1461.             }
  1462.  
  1463.             // hell if I know; he's just dead!!!
  1464.             bprint (" died\n");
  1465.         }
  1466.     }
  1467. };
  1468.